Learn R Programming

bnlearn (version 5.0.1)

multivariate normal distribution: Gaussian Bayesian networks and multivariate normals

Description

Convert a Gaussian Bayesian network into the multivariate normal distribution that is its global distribution, and vice versa.

Usage

gbn2mvnorm(fitted)
mvnorm2gbn(dag, mu, sigma)

Value

gbn2mvnorm() returns a list with elements "mu" (the vector of expectations) and "sigma" (the covariance matrix).

mvnorm2gbn() returns an object of class bn.fit.

Arguments

fitted

an object of class bn.fit.

dag

an object of class bn, the structure of the network that will be returned.

mu

a numeric vector, the expectation of the multivariate normal.

sigma

a square numeric matrix, the covariance matrix of the multivariate normal.

Author

Marco Scutari

References

Pourahmadi M (2011). "Covariance Estimation: The GLM and Regularization Perspectives". Statistical Science, 26(3), 369--387.

See Also

bn.fit.

Examples

Run this code
data(gaussian.test)
dag = model2network("[A][B][E][G][C|A:B][D|B][F|A:D:E:G]")
bn = bn.fit(dag, gaussian.test)
mvn = gbn2mvnorm(bn)
bn2 = mvnorm2gbn(dag, mu = mvn$mu, sigma = mvn$sigma)
all.equal(bn, bn2)

Run the code above in your browser using DataLab